import { http } from "@/utils/http"
import { CommonResponse } from "./common"


/**
 * 订单列表分页参数
 */
export type OrderListParams = {
  pageNum: number
  pageSize: number
  status?: number
  orderTimeStart?: string
  orderTimeEnd?: string
  userPhone?: string
}

/**
 * 订单列表返回数据
 */
export type OrderListData = {
  total: number
  pageNum: number
  pageSize: number
  records: {
    id: number
    orderNo: string
    goodsNum: number
    salePrice: number
    userPhone: string
    status: number
    orderTime: string
    payTime: string
  }[]
}

// 查询订单列表
export const getOrderList = (data: OrderListParams) => {
  return http.request<CommonResponse<OrderListData>>("post", "/api/platform/orders/page", { data })
}